/**
 * GroupListController.java
 * Version 1.0.0
 * Created on 2019年1月16日
 */
package com.yincheng.oes.business.group.controller;

import com.yincheng.oes.business.group.model.query.QueryParamBean;
import com.yincheng.oes.business.group.model.result.QueryResultRowBean;
import com.yincheng.oes.business.group.service.GroupListService;
import com.yincheng.oes.business.util.Tools;
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author yangsy
 * @version 1.0.0
 * @since 创建时间：2019年1月16日
 * <p>
 * 功能描述：
 * <p>
 * 邮箱地址：446948434@qq.com
 */
@Controller
@RequestMapping("/groupList")
public class GroupListController {

    @Autowired
    private GroupListService groupListService;

    /**
     * 获取试卷列表展示页面
     *
     * @param model
     * @return
     */
    @RequestMapping(value = "/groupListPage.html", method = RequestMethod.GET)
    public String quesListPage(Model model) {
        return "business/group/grouplist";
    }

    @RequestMapping(value = "/groupPaperPage.html", method = RequestMethod.GET)
    public String groupPaperPage(Model model, String paperId) {
        model.addAttribute("paperId", paperId);
        return "business/paper/grouplist";
    }

    /**
     * 根据参数获取试卷列表数据
     *
     * @param bean
     * @return
     */
    @RequestMapping(value = "/getList.json", method = RequestMethod.GET)
    @ResponseBody
    public String list(QueryParamBean bean) {
        Pair<Integer, List<QueryResultRowBean>> pair = groupListService.getListByParam(bean);
        return Tools.toEasyuiDataGrid(pair.getLeft(), pair.getRight());
    }

   
}
